package
{
	/* This class wraps the library responder, and calls the test case async 
	 * checkpoint function, allowing generaly cleaner test cases to be written in the unit test 
	 * library, otherwise this code must be duplicated in each.
	 */
	import com.salesforce.AsyncResponder;
	
	import flash.events.Event;
	
	import flexunit.framework.TestCase;

	public class AsyncTestResponder extends AsyncResponder
	{
		private var testCallback:Function;
		
		public function AsyncTestResponder(result:Function, testCase:TestCase, delay:Number)
		{
			super(result);
			testCallback = testCase.addAsync(function (e:Event):void { trace("hello!"); }, delay);
		}

		public override function result(data:Object):void {
			super.result(data);
			testCallback(new Event("none"));
		}
		
		public override function fault(data:Object):void {
			super.fault(data);
			testCallback(new Event("none"));
		}
		
	}
}